//	--------------------------------------------------------------------
//	Copyright(C) 2006,2007 Zhao Yukun. All rights reserved.
//	This file is a part of the Xeres system.
//	Xeres 2007
//	Contact : xeres.engine@gmail.com
//	$(reservedInfo)
//	$(reservedDeclaration)
//	--------------------------------------------------------------------
///	@file	<IAttribute.h>
///	@path	~/src/scene/
///	@date	2007/11/02
///	@desc	Attribute that controls scene elements.

#pragma once

#include "xeres.h"

#include "object/IVar.h"

#include "graphics/animation/frame.h"

#include "scene/ILive.h"

namespace xeres {

	/*!
		\class	IAttribute
		\brief	Attribute to control scene objects.
				Notice! Attribute may be shared among objects.
	*/
	class IAttribute : public IObject
	{
	public:

		/// \ctor
		IAttribute( void );

		/// \dtor
		virtual ~IAttribute( void );

		DECL_IOBJECT_INTERFACE( IAttribute , IObject );

	public:

		// interface

		/*!
			\brief		Call when attached to an ILive instance.
		*/
		virtual void OnAttach( ILive * host ) = 0;

		/*!
			\brief		Call when detached to an ILive instance.
		*/
		virtual void OnDetach( ILive * host ) = 0;

		/*!
			\brief		Tick to make attribute updated.
		*/
		virtual void Tick( const Frame& frame ) = 0;

		/*!
			\brief		Synchronized tick call.
		*/
		virtual void TickSync( void ) = 0;

		// we might duplicate data to cache a value for drawing
		// fetch & store must be divided into 2 states

		/*!
			\brief		Get value for current 'Tick' calculation.
						Notice! The return value should not be stored!
		*/
		virtual RefWeak<IVar> GetTickValue( void ) = 0;

		/*!
			\brief		Get value for 'Render' calculation.
						Notice! The return value should not be stored!
		*/
		virtual const RefWeak<IVar> GetRenderValue( void ) = 0;

	};

} // namespace xeres
